package com.icloud.article.boot.controller.app;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.icloud.article.boot.dto.AttentionPageDto;
import com.icloud.article.boot.service.AttentionService;
import com.icloud.article.boot.vo.AttentionVo;
import com.icloud.common.core.api.CommonResult;
import com.icloud.common.web.util.AuthUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "App关注接口")
@RequestMapping("/app/attention")
@RequiredArgsConstructor
public class AppAttentionController {

    private final AttentionService attentionService;
    private final AuthUtil authUtil;

    @ApiOperation("关注")
    @PutMapping("/{customerId}")
    public CommonResult<Boolean> attention(@ApiParam("app客户id") @PathVariable("customerId") Long customerId){
        return CommonResult.success(attentionService.attention(customerId));
    }

    @ApiOperation("取消关注")
    @PutMapping("/cancel/{customerId}")
    public CommonResult<Boolean> cancel(@ApiParam("用户id") @PathVariable("customerId") Long customerId){
        return CommonResult.success(attentionService.cancel(customerId));
    }

    @ApiOperation("关注列表")
    @PostMapping("/attentionPage")
    public CommonResult<IPage<AttentionVo>> attentionPage(@Validated @RequestBody AttentionPageDto dto){
        return CommonResult.success(attentionService.attentionPage(dto));
    }

    @ApiOperation("粉丝列表")
    @PostMapping("/fansPage")
    public CommonResult<IPage<AttentionVo>> fansPage(@Validated @RequestBody AttentionPageDto dto){
        return CommonResult.success(attentionService.fansPage(dto));
    }
}
